﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Srv3CodeTool
{
    public partial class FrmPtrCheck : Form
    {
        public FrmPtrCheck()
        {
            InitializeComponent();
        }

        private void btnProjectPath_Click(object sender, EventArgs e)
        {
            folderBrowserDialog1.ShowDialog();
            if (folderBrowserDialog1.SelectedPath != "")
                txtSrcPath.Text = folderBrowserDialog1.SelectedPath;
//             openFileDialog1.ShowDialog();
//             txtSrcPath.Text = "";
//             if (openFileDialog1.SafeFileNames.Length > 0)
//             {
//                 foreach (string strFile in openFileDialog1.SafeFileNames)
//                 {
//                     txtSrcPath.Text += strFile + "   ";
//                 }
//             }
        }

        private void btnCheck_Click(object sender, EventArgs e)
        {
            try
            {
                Functions func = new Functions();
                rtbCheckResult.Text = func.CheckPtrFromPath(txtSrcPath.Text.ToString(), cbCheckSubDir.Checked);
            }
            catch (System.Exception ex)
            {
                Log.LogSave(ex.ToString(), LOGTYPE.LOGTYPE_ERROR);
            }
        }

        private void FrmPtrCheck_Load(object sender, EventArgs e)
        {
            Config config = new Config();
            config.LoadFromXmlFile();
            cbCheckSubDir.Checked = config.PtrCheckSub;
        }
    }
}
